package net.xdclass.order_service.controller;

import net.xdclass.order_service.service.ProductOrderFeignService;
import net.xdclass.order_service.service.ProductOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("api/v1/order")
public class OrderController {


    @Autowired
    private ProductOrderService productOrderService;

    @Autowired
    private ProductOrderFeignService productOrderFeignService;


    @RequestMapping("save")
    public Object save(@RequestParam("user_id")int userId, @RequestParam("product_id") int productId){

        return productOrderService.save(userId, productId);
    }


    @RequestMapping("save2")
    public Object save2(@RequestParam("user_id")int userId, @RequestParam("product_id") int productId){

        return productOrderFeignService.find(productId);
    }




}
